<?php 
$webroot="";
if(session::is_manager()==TRUE)
{
	require_once 'html/admintemplate.php';
}
else 
{
	require_once 'html/template.php';
}

?>
<script type="text/javascript">
function closeticket(ticketid,userid)
{
	$.ajax({
		url: "closeticket.php" ,
		type:'get',
		data:"ticketid="+ticketid+"&userid="+userid,
		cache: false,
		success: function(j){
		$("#resultclose").html(j);
	  	}
	});
}

</script>

<center>
<?php
foreach($GetTicketSoure as $ShowTicketDetail)
{
	if($ShowTicketDetail['userpost']==$UserId)
	{
		?>
		<div class="classask">
		<?php
		echo $ShowTicketDetail['date']."<br/>
		<a href='orderhistory.php?userid=$UserId'>$UserId</a> Ask: <br/>
		";
		echo htmlentities($ShowTicketDetail['contents']);?>
		</div>
		<?php 
	}
	else if($ShowTicketDetail['userpost']==572)
	{
			?>
		<div class="classreply">
		<?php
		echo $ShowTicketDetail['date']."<br/>
		Admin Reply: <br/>";
		echo $ShowTicketDetail['contents'];?>
		</div>
		<?php 
	}
}
if($GetTicketSoure[0]['closed']==0)
{
	
?>

<a href="#" onclick="javascript:closeticket(<?php echo $Ticketid;?>,<?php echo $UserId;?>)" > Close Ticket</a>
<form id="resultclose" name="reply" action="ticketreply.php?ticketid=<?php echo $Ticketid;?>&userid=<?php echo $UserId;?>" method="post" >
<textarea name="replysoure" rows="9" cols="100"></textarea><br/>
<input name="submit" type="submit" value="Reply" />
</form>
</center>
</html>

<?php 
}

?>